﻿Imports System.Math
<Serializable()> Public Class SvVector
    Private Const PI As Double = 3.14159265358979

    Private mDe As Double
    Private mDn As Double
    Private mDh As Double

    Sub New()

    End Sub

    Sub New(ByVal P1 As TSPCoor, ByVal P2 As TSPCoor)
        mDe = P2.Coor_H - P1.Coor_H
        mDn = P2.Coor_V - P1.Coor_V
    End Sub

    Public ReadOnly Property Azimuth() As Double

        Get
            Return PI / 2 * (2 + Sign(-mDe + 1.0E-30)) + Math.Atan(mDn / (mDe + 1.0E-30))

        End Get
    End Property

    Public ReadOnly Property Distance() As Double
        Get
            Return Math.Sqrt(mDe * mDe + mDn * mDn)
        End Get
    End Property

    Public ReadOnly Property Length() As Double
        Get
            Return Math.Sqrt(mDe * mDe + mDn * mDn + mDh * mDh)
        End Get
    End Property

    Public ReadOnly Property VertcalAngle() As Double
        Get
            Return Math.Atan(mDh / (Distance() + 1.0E-30))
        End Get
    End Property



End Class
